package com.rui.study.micro.goods;

import com.rui.study.micro.goods.support.SimpleApplicationInitializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@SpringBootApplication
@EnableDiscoveryClient
@EnableTransactionManagement
@EnableAspectJAutoProxy
public class GoodsApp {

    private static final Logger LOGGER = LoggerFactory.getLogger(GoodsApp.class);


    public static void main(String[] args) {
        SpringApplication app = new SpringApplication();
        app.addInitializers(new SimpleApplicationInitializer());
        ConfigurableApplicationContext ctx = app.run(GoodsApp.class);
        MappingJackson2HttpMessageConverter jsonConverter = ctx.getBean(MappingJackson2HttpMessageConverter.class);
//        jsonConverter.getObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
        LOGGER.info(jsonConverter.toString());
    }

}
